import React, { useCallback, useState } from 'react'
import Child from './child';

const CallbackTest = () => {
	const [count, setCount] = useState(0)

	const getList = useCallback((n: number) => {
		return Array(n).fill(undefined).map((item, i) => ({
			id: i,
			name: "张三" + i
		}));
	}, [])

	return (
		<div>
			<Child getList={getList} />
			<button onClick={() => {setCount(count + 1)}}>count + 1</button>
		</div>
	)
}

export default CallbackTest
